package com.hxlc.controller;

import cn.hutool.core.date.LocalDateTimeUtil;
import com.alibaba.fastjson.JSONObject;
import com.hxlc.model.QueryResp;
import com.hxlc.pojo.AgrisResp;
import com.hxlc.service.StatuService;
import com.hxlc.util.FileReadUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

@Api(tags = "天镜 设备、数据库状态")
@RestController
@RequestMapping("/api/statu")
@Slf4j
public class StatuAction {

    @Autowired
    StatuService statuService;

    @Resource
    FileReadUtil fileReadUtil;

    @ApiOperation(value = "获取服务器状态")
    @RequestMapping(value = "/getServerStatu",method = RequestMethod.GET)
    private ResponseEntity getServerStatu(@RequestParam String module){
//        try {
//            return new ResponseEntity(statuService.getServerStatu(module), HttpStatus.OK);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

        String string = fileReadUtil.getString("data/getStatu.json");
        List<QueryResp> queryRespList = JSONObject.parseArray(string, QueryResp.class);
        return new ResponseEntity(queryRespList, HttpStatus.OK);
    }
}
